cmake_minimum_required(VERSION 3.1)

project(lv_port_sunxi)

set(CMAKE_C_FLAGS_DEBUG "-O3 -g")
set(CMAKE_C_FLAGS_RELEASE "-O3")

#set(CMAKE_SYSROOT "/home/he/Tina5.0-V1.1/out/t113/pi/openwrt/staging_dir/target")

include_directories(
        .
        "freetype2"
        "/home/he/Tina5.0-V1.1/out/t113/pi/openwrt/staging_dir/target/usr/include"
)

link_directories(
        "/home/he/Tina5.0-V1.1/out/t113/pi/openwrt/staging_dir/target/root-t113-pi/lib"
        "/home/he/Tina5.0-V1.1/out/t113/pi/openwrt/staging_dir/target/usr/lib"
)

set(LVGL_FLAGS -DUSE_SUNXIFB_DOUBLE_BUFFER
        -DUSE_SUNXIFB_CACHE
        -DUSE_SUNXIFB_G2D
        -DUSE_SUNXIFB_G2D_ROTATE
        -DCONF_G2D_VERSION_NEW

        #        -DLV_USE_SUNXIFB_G2D_FILL
        #        -DLV_USE_SUNXIFB_G2D_BLEND
        #        -DLV_USE_SUNXIFB_G2D_BLIT
        #        -DLV_USE_SUNXIFB_G2D_SCALE
)

add_subdirectory(lvgl)
target_compile_definitions(lvgl PRIVATE ${LVGL_FLAGS})
add_subdirectory(lv_drivers)
target_compile_definitions(lv_drivers PRIVATE ${LVGL_FLAGS})

file(GLOB_RECURSE ICONS icons/*.c)

#add_compile_definitions(-DLV_LVGL_H_INCLUDE_SIMPLE)

add_compile_options(-pipe -march=armv7-a -mtune=cortex-a7 -mfpu=neon -mfloat-abi=hard -fstack-protector)

add_executable(${PROJECT_NAME} main.c mouse_cursor_icon.c lv_page_main.c lv_page_menu.c ${ICONS})
target_link_libraries(${PROJECT_NAME} PRIVATE lvgl lvgl_drivers lvgl_demos uapi freetype)